<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script src="stack.js"></script>
    <script>
        var huiwen = function(s) {
            var stack = new fi.Stack();
            //压栈
            for (var i = 0; i < s.length; i++) {
                stack.push(s[i]);
            }
            //出栈
            var ans = "";
            for (var i = 0; i < s.length; i++) {
                ans = ans + stack.shift();
            }
            return s = ans;
        }
        console.log(huiwen("先进先出"));
        console.log(huiwen("队列是先进先出"));
    </script>
</body>

</html>